<!DOCTYPE html>
<html ng-app="ionicApp">
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title>Hybrid App JsPlugin</title>
    <link href="https://cdn.staticfile.org/ionic/1.3.2/css/ionic.css" rel="stylesheet">
    <script src="https://cdn.staticfile.org/ionic/1.3.2/js/ionic.bundle.min.js"></script>
</head>
<body>
<div class="content scroll padding scroll-content" style="overflow-y:auto">

        <p>
        <button class="button  button-positive" style="" onclick="closePage()">
            closePage
        </button>
        <button class="button  button-positive" onclick="openPage()">openPage</button>
<!--        <button class="button  button-positive" onclick="openPageTitle()">openPageTitle</button>-->
    </p>
<!--    <p>-->
<!--        <button class="button  button-positive" onclick="loadPage()">loadPage</button>-->
<!--        <button class="button  button-positive" onclick="setTitle()">setTitle</button>-->
<!--    </p>-->
    <p>
<!--        <button class="button  button-positive" onclick="goHome()">goHome</button>-->
        <button class="button  button-positive" onclick="callAppInfo()">
            runtime.getAppInfo()
        </button>
    </p>

</div>

<script type="text/javascript">

var ua = navigator.userAgent;
var quick = ua.match(/HarHybridJs/i);


function closePage(){
    if(window.page_closePage && window.page_closePage.call){
            window.page_closePage.call("");
    }else{
      alert("closePage不支持");
    }
}

function openPage(){
    if(quick){
       if(window.page_openPage && window.page_openPage.call){
         var jsonObj = {"url":"http://www.baidu.com"};
         var jsonStr = JSON.stringify(jsonObj);
         window.page_openPage.call(jsonStr);
       }
    } else {
        window.open("http://www.baidu.com");
    }
}

function openPageTitle(){
    if(quick){
        var jsonObj = {"updateTitle":false,"title":"标题测试"};
        var jsonStr = JSON.stringify(jsonObj);
        window.page.openPage("http://www.baidu.com",1,jsonStr);
    } else {
         alert("不支持");
    }
}

function loadPage(){
      window.page.loadPage("http://www.baidu.com",true);
}

function callAppInfo(){
      if (window.runtime_getAppInfo && window.runtime_getAppInfo.call) {
            var appInfo = window.runtime_getAppInfo.call("jsCallApp");
            alert(appInfo);
      }else{
         alert("不支持");
      }
}

function setTitle(){
      window.page.setTitle("JS设置的Title");
}

function goHome(){
      window.page.goHome();
}

function onAppCallBack(a){
    var last = JSON.stringify(a);
    alert("onAppCallBack->"+last);
}


</script>
</body>
</html>



